<?php
namespace app\common\service;
use think\Cookie;


class SessionUser
{
	public function login($user,$token){
		Cookie::set('user',serialize($user),3600*24*14);
		Cookie::delete($user['phone']);
		Cookie::set('token',$token,3600*24*14);
		Cookie::delete($user['phone']);
		session($user['phone'],null);
	}

	public function logout(){
		Cookie::delete('user');
		Cookie::clear('think_');
	}

	public function user(){
		return unserialize(cookie('user'));
	}
}